TODO

  • Demonstrate extra value
  • Scaffold exploitation of extra value
  • Data semantics: what are nodes, what are edges?
  • Squeeze in some graph theory in there
  • People, posts... then pages, communities, links co-shared etc
  • No FB token sharing, API limits will easily be exceeded (Pedro said)

  • Failure mode: other modules of Netvizz

Another scraping tool: fb_scraper

Designed and programmed by Pedro.

  1. Co-reaction: users connect posts with the same reaction
  2. User co-interaction: users interact on same posts
  3. Extendability

The steps

  1. Become a Facebook developer
  2. Set up a Facebook app and API token
  3. Download fb_scraper
  4. Connect fb_scraper to this Notebook
  5. Set up scrape manager
  6. Set up jobs
  7. Run jobs
  8. Collect output
  9. Further analysis

1. Become a Facebook developer

Apply to be a Facebook developer.

2. Set up a Facebook app and get API token

3. Download fb_scraper

We download with git. Run these in Terminal

git clone https://github.com/bacilo/facebook-scraper.git
cd facebook-scraper
git checkout incorporate

4. Connect fb_scraper to this Notebook


In [1]:
import sys

In [2]:
sys.path.append('../../../facebook-scraper')

In [3]:
import fb_scraper
import fb_scraper.prodcons
import fb_scraper.job

Store the API token from 2. in a file called config.ini, which should contain the following two lines

[creds]
access_token = yourTokenHere

5. Set up scrape manager

Read the API token into Python


In [4]:
import configparser

In [5]:
config = configparser.ConfigParser()
config.read("config.ini")
creds = config["creds"]

Create a manager, a software object which runs the scrapes.


In [6]:
mgr = fb_scraper.prodcons.Manager(dict(creds))

6. Set up jobs

The fb_scraper can do five kinds of jobs:

  • FeedJob
  • GroupJob
  • PageJob
  • PostJob
  • GraphFromPageJob

Create a PageJob


In [7]:
ethospagejob = fb_scraper.job.PageJob(node_id="822254694506527")

Pass it to the manager


In [8]:
mgr.add_job(ethospagejob)

7. Run jobs


In [9]:
mgr.start()


(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 0 responses,1 requests,
(Thread-5  - run): About to send 1 requests
(Thread-5  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 0 responses,1 requests,1 responses_queued,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 1 responses,6 requests,1 responses_queued,97 attachments,100 posts,499 reactions,40 comm,4 sharedposts,
(Thread-8  - run): About to send 5 requests
(Thread-8  - run): queued 3 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 2 responses,11 requests,4 responses_queued,194 attachments,200 posts,1400 reactions,100 comm,10 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 3 responses,11 requests,4 responses_queued,194 attachments,200 posts,1400 reactions,100 comm,10 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 4 responses,11 requests,4 responses_queued,194 attachments,200 posts,1400 reactions,100 comm,10 sharedposts,
(Thread-7  - run): About to send 5 requests
(Thread-8  - run): About to send 2 requests
(Thread-8  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 4 responses,11 requests,5 responses_queued,194 attachments,200 posts,1400 reactions,100 comm,10 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 5 responses,11 requests,5 responses_queued,194 attachments,200 posts,1401 reactions,100 comm,10 sharedposts,
(Thread-7  - run): queued 3 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 5 responses,11 requests,8 responses_queued,194 attachments,200 posts,1401 reactions,100 comm,10 sharedposts,
(Thread-8  - run): About to send 1 requests
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 6 responses,14 requests,8 responses_queued,288 attachments,300 posts,1490 reactions,102 comm,12 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 7 responses,14 requests,8 responses_queued,288 attachments,300 posts,1494 reactions,102 comm,12 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 8 responses,14 requests,8 responses_queued,288 attachments,300 posts,1494 reactions,102 comm,12 sharedposts,
(Thread-8  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 9 responses,14 requests,9 responses_queued,288 attachments,300 posts,1494 reactions,102 comm,12 sharedposts,
(Thread-6  - run): About to send 3 requests
(Thread-7  - run): About to send 2 requests
(Thread-7  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 9 responses,14 requests,10 responses_queued,288 attachments,300 posts,1494 reactions,102 comm,12 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 10 responses,14 requests,10 responses_queued,288 attachments,300 posts,1494 reactions,102 comm,12 sharedposts,
(Thread-6  - run): queued 2 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 11 responses,15 requests,12 responses_queued,347 attachments,360 posts,1632 reactions,106 comm,13 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 12 responses,15 requests,12 responses_queued,347 attachments,360 posts,1632 reactions,106 comm,13 sharedposts,
(Thread-7  - run): About to send 2 requests
(Thread-7  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 12 responses,15 requests,13 responses_queued,347 attachments,360 posts,1632 reactions,106 comm,13 sharedposts,
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 13 responses,15 requests,13 responses_queued,347 attachments,360 posts,1676 reactions,106 comm,13 sharedposts,
(Thread-6  - run): About to send 1 requests
(Thread-6  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 14 responses,15 requests,14 responses_queued,347 attachments,360 posts,1676 reactions,106 comm,13 sharedposts,
(Thread-7  - run): About to send 1 requests
(Thread-7  - run): queued 1 responses received
(Thread-4  - check_jobs_statuses): Job page_feed_822254694506527, total: 15 responses,15 requests,15 responses_queued,347 attachments,360 posts,1676 reactions,106 comm,13 sharedposts,
(Thread-4  - check_jobs_statuses): Job 2017-11-08_22_01_17_808587_page_feed_822254694506527 has finished!

8. Collect output

Find the output in subdirectories of output, one for each job. You can open them with Tableau or whatever suits your fancy


In [10]:
def get_job_filepath(job, dataset):
    """Get a dataset file path of job"""
    assert dataset in job.writers, "Job {} does not contain dataset {}".format(job.job_id, dataset)
    return "".join([job.writers[dataset].path, job.writers[dataset].file_name])

In [11]:
import pandas as pd
%matplotlib inline

Let's see what did we acquire.


In [12]:
ethosposts = pd.read_csv(get_job_filepath(ethospagejob, 'posts'),
                         parse_dates=['created_time', 'updated_time'], skipfooter=1, engine="python")

In [13]:
ethosposts.shape


Out[13]:
(359, 18)

In [14]:
ethosposts.sample(3)


Out[14]:
id story created_time message picture caption description from_id from_name name object_id parent_id source status_type link type updated_time shares_count
38 822254694506527_1333878410010817 NaN 2017-05-22 16:41:15 Melissa Gregg is joining us the next couple of... https://scontent.xx.fbcdn.net/v/t1.0-0/c35.0.1... PublicETHOS#20 w/Melissa Gregg When: 23 May from 13-14:00\nWhere: IT Universi... 822254694506527 ETHOS Lab PublicETHOS#20 w/Melissa Gregg 2.041214e+14 NaN NaN shared_story https://www.facebook.com/events/204121426772848/ event 2017-05-22 16:41:15 0
272 822254694506527_896703193728343 NaN 2015-10-12 08:30:00 Here are 20 stats that should convince anyone ... https://external.xx.fbcdn.net/safe_image.php?d... forbes.com Big data is not a fad. We are just at the begi... 822254694506527 ETHOS Lab Big Data: 20 Mind-Boggling Facts Everyone Must... NaN NaN NaN shared_story http://www.forbes.com/sites/bernardmarr/2015/0... link 2015-10-12 08:30:00 0
271 822254694506527_897489013649761 NaN 2015-10-13 08:00:00 Want to know how the Culture Night 2015 went? ... https://external.xx.fbcdn.net/safe_image.php?d... ethos.itu.dk October 13, 2015 kristineolsen Blog No Comment... 822254694506527 ETHOS Lab ETHOSLAB at #kulturnatten2015 NaN NaN NaN shared_story https://ethos.itu.dk/2015/10/13/ethoslab-at-ku... link 2015-10-13 08:00:00 0

In [15]:
ethosposts.type.value_counts().plot.pie(autopct='%.2f', figsize=(6, 6));


Did we make it so far? Brilliant!

Compare output with Netvizz files. What columns?

9.1 Analysis: co-reaction graph


In [16]:
import load_csv
from fb_gexf.fbgexf import GexfManager, CoReactionGraph, UserCoInteractionGraph

In [17]:
print(CoReactionGraph.__doc__)


    The idea is to generate a graph where:

    Nodes: posts
    Edges: there is a connection between two nodes, if a certain user has the
        same reaction to both posts (i.e. 'LOVE's them both or comments both
        for instance)
    

In [18]:
def write_graph(job, gtype):
    """Write out a graph of type CoReactionGraph of UserCoInteractionGraph for job"""
    assert isinstance(job, fb_scraper.job.Job)
    assert gtype in ['CoReactionGraph', 'UserCoInteractionGraph']
    
    gmgr = GexfManager()
    posts = load_csv.load_posts(get_job_filepath(job, 'posts'))
    comments = load_csv.load_comments(get_job_filepath(job, 'comments'))
    reactions = load_csv.load_reactions(get_job_filepath(job, 'reactions'))
    gpath = job.writers['posts'].path

    if gtype == 'CoReactionGraph':
        gmgr.add_method(CoReactionGraph(gpath))
    elif gtype == 'UserCoInteractionGraph':
        gmgr.add_method(UserCoInteractionGraph(gpath))

    gmgr.load(posts, comments, reactions)
    
    gmgr.write()

In [19]:
write_graph(ethospagejob, 'CoReactionGraph')


adding reactions
adding comments
adding posts
performing analysis... this one might take a while for large datasets
processed 1 of 45 comments            
processed 2 of 45 comments            
processed 3 of 45 comments            
processed 4 of 45 comments            
processed 5 of 45 comments            
processed 6 of 45 comments            
processed 7 of 45 comments            
processed 8 of 45 comments            
processed 9 of 45 comments            
processed 10 of 45 comments            
processed 11 of 45 comments            
processed 12 of 45 comments            
processed 13 of 45 comments            
processed 14 of 45 comments            
processed 15 of 45 comments            
processed 16 of 45 comments            
processed 17 of 45 comments            
processed 18 of 45 comments            
processed 19 of 45 comments            
processed 20 of 45 comments            
processed 21 of 45 comments            
processed 22 of 45 comments            
processed 23 of 45 comments            
processed 24 of 45 comments            
processed 25 of 45 comments            
processed 26 of 45 comments            
processed 27 of 45 comments            
processed 28 of 45 comments            
processed 29 of 45 comments            
processed 30 of 45 comments            
processed 31 of 45 comments            
processed 32 of 45 comments            
processed 33 of 45 comments            
processed 34 of 45 comments            
processed 35 of 45 comments            
processed 36 of 45 comments            
processed 37 of 45 comments            
processed 38 of 45 comments            
processed 39 of 45 comments            
processed 40 of 45 comments            
processed 41 of 45 comments            
processed 42 of 45 comments            
processed 43 of 45 comments            
processed 44 of 45 comments            
processed 45 of 45 comments            
processed 1 of 434 reactions               
processed 2 of 434 reactions               
processed 3 of 434 reactions               
processed 4 of 434 reactions               
processed 5 of 434 reactions               
processed 6 of 434 reactions               
processed 7 of 434 reactions               
processed 8 of 434 reactions               
processed 9 of 434 reactions               
processed 10 of 434 reactions               
processed 11 of 434 reactions               
processed 12 of 434 reactions               
processed 13 of 434 reactions               
processed 14 of 434 reactions               
processed 15 of 434 reactions               
processed 16 of 434 reactions               
processed 17 of 434 reactions               
processed 18 of 434 reactions               
processed 19 of 434 reactions               
processed 20 of 434 reactions               
processed 21 of 434 reactions               
processed 22 of 434 reactions               
processed 23 of 434 reactions               
processed 24 of 434 reactions               
processed 25 of 434 reactions               
processed 26 of 434 reactions               
processed 27 of 434 reactions               
processed 28 of 434 reactions               
processed 29 of 434 reactions               
processed 30 of 434 reactions               
processed 31 of 434 reactions               
processed 32 of 434 reactions               
processed 33 of 434 reactions               
processed 34 of 434 reactions               
processed 35 of 434 reactions               
processed 36 of 434 reactions               
processed 37 of 434 reactions               
processed 38 of 434 reactions               
processed 39 of 434 reactions               
processed 40 of 434 reactions               
processed 41 of 434 reactions               
processed 42 of 434 reactions               
processed 43 of 434 reactions               
processed 44 of 434 reactions               
processed 45 of 434 reactions               
processed 46 of 434 reactions               
processed 47 of 434 reactions               
processed 48 of 434 reactions               
processed 49 of 434 reactions               
processed 50 of 434 reactions               
processed 51 of 434 reactions               
processed 52 of 434 reactions               
processed 53 of 434 reactions               
processed 54 of 434 reactions               
processed 55 of 434 reactions               
processed 56 of 434 reactions               
processed 57 of 434 reactions               
processed 58 of 434 reactions               
processed 59 of 434 reactions               
processed 60 of 434 reactions               
processed 61 of 434 reactions               
processed 62 of 434 reactions               
processed 63 of 434 reactions               
processed 64 of 434 reactions               
processed 65 of 434 reactions               
processed 66 of 434 reactions               
processed 67 of 434 reactions               
processed 68 of 434 reactions               
processed 69 of 434 reactions               
processed 70 of 434 reactions               
processed 71 of 434 reactions               
processed 72 of 434 reactions               
processed 73 of 434 reactions               
processed 74 of 434 reactions               
processed 75 of 434 reactions               
processed 76 of 434 reactions               
processed 77 of 434 reactions               
processed 78 of 434 reactions               
processed 79 of 434 reactions               
processed 80 of 434 reactions               
processed 81 of 434 reactions               
processed 82 of 434 reactions               
processed 83 of 434 reactions               
processed 84 of 434 reactions               
processed 85 of 434 reactions               
processed 86 of 434 reactions               
processed 87 of 434 reactions               
processed 88 of 434 reactions               
processed 89 of 434 reactions               
processed 90 of 434 reactions               
processed 91 of 434 reactions               
processed 92 of 434 reactions               
processed 93 of 434 reactions               
processed 94 of 434 reactions               
processed 95 of 434 reactions               
processed 96 of 434 reactions               
processed 97 of 434 reactions               
processed 98 of 434 reactions               
processed 99 of 434 reactions               
processed 100 of 434 reactions               
processed 101 of 434 reactions               
processed 102 of 434 reactions               
processed 103 of 434 reactions               
processed 104 of 434 reactions               
processed 105 of 434 reactions               
processed 106 of 434 reactions               
processed 107 of 434 reactions               
processed 108 of 434 reactions               
processed 109 of 434 reactions               
processed 110 of 434 reactions               
processed 111 of 434 reactions               
processed 112 of 434 reactions               
processed 113 of 434 reactions               
processed 114 of 434 reactions               
processed 115 of 434 reactions               
processed 116 of 434 reactions               
processed 117 of 434 reactions               
processed 118 of 434 reactions               
processed 119 of 434 reactions               
processed 120 of 434 reactions               
processed 121 of 434 reactions               
processed 122 of 434 reactions               
processed 123 of 434 reactions               
processed 124 of 434 reactions               
processed 125 of 434 reactions               
processed 126 of 434 reactions               
processed 127 of 434 reactions               
processed 128 of 434 reactions               
processed 129 of 434 reactions               
processed 130 of 434 reactions               
processed 131 of 434 reactions               
processed 132 of 434 reactions               
processed 133 of 434 reactions               
processed 134 of 434 reactions               
processed 135 of 434 reactions               
processed 136 of 434 reactions               
processed 137 of 434 reactions               
processed 138 of 434 reactions               
processed 139 of 434 reactions               
processed 140 of 434 reactions               
processed 141 of 434 reactions               
processed 142 of 434 reactions               
processed 143 of 434 reactions               
processed 144 of 434 reactions               
processed 145 of 434 reactions               
processed 146 of 434 reactions               
processed 147 of 434 reactions               
processed 148 of 434 reactions               
processed 149 of 434 reactions               
processed 150 of 434 reactions               
processed 151 of 434 reactions               
processed 152 of 434 reactions               
processed 153 of 434 reactions               
processed 154 of 434 reactions               
processed 155 of 434 reactions               
processed 156 of 434 reactions               
processed 157 of 434 reactions               
processed 158 of 434 reactions               
processed 159 of 434 reactions               
processed 160 of 434 reactions               
processed 161 of 434 reactions               
processed 162 of 434 reactions               
processed 163 of 434 reactions               
processed 164 of 434 reactions               
processed 165 of 434 reactions               
processed 166 of 434 reactions               
processed 167 of 434 reactions               
processed 168 of 434 reactions               
processed 169 of 434 reactions               
processed 170 of 434 reactions               
processed 171 of 434 reactions               
processed 172 of 434 reactions               
processed 173 of 434 reactions               
processed 174 of 434 reactions               
processed 175 of 434 reactions               
processed 176 of 434 reactions               
processed 177 of 434 reactions               
processed 178 of 434 reactions               
processed 179 of 434 reactions               
processed 180 of 434 reactions               
processed 181 of 434 reactions               
processed 182 of 434 reactions               
processed 183 of 434 reactions               
processed 184 of 434 reactions               
processed 185 of 434 reactions               
processed 186 of 434 reactions               
processed 187 of 434 reactions               
processed 188 of 434 reactions               
processed 189 of 434 reactions               
processed 190 of 434 reactions               
processed 191 of 434 reactions               
processed 192 of 434 reactions               
processed 193 of 434 reactions               
processed 194 of 434 reactions               
processed 195 of 434 reactions               
processed 196 of 434 reactions               
processed 197 of 434 reactions               
processed 198 of 434 reactions               
processed 199 of 434 reactions               
processed 200 of 434 reactions               
processed 201 of 434 reactions               
processed 202 of 434 reactions               
processed 203 of 434 reactions               
processed 204 of 434 reactions               
processed 205 of 434 reactions               
processed 206 of 434 reactions               
processed 207 of 434 reactions               
processed 208 of 434 reactions               
processed 209 of 434 reactions               
processed 210 of 434 reactions               
processed 211 of 434 reactions               
processed 212 of 434 reactions               
processed 213 of 434 reactions               
processed 214 of 434 reactions               
processed 215 of 434 reactions               
processed 216 of 434 reactions               
processed 217 of 434 reactions               
processed 218 of 434 reactions               
processed 219 of 434 reactions               
processed 220 of 434 reactions               
processed 221 of 434 reactions               
processed 222 of 434 reactions               
processed 223 of 434 reactions               
processed 224 of 434 reactions               
processed 225 of 434 reactions               
processed 226 of 434 reactions               
processed 227 of 434 reactions               
processed 228 of 434 reactions               
processed 229 of 434 reactions               
processed 230 of 434 reactions               
processed 231 of 434 reactions               
processed 232 of 434 reactions               
processed 233 of 434 reactions               
processed 234 of 434 reactions               
processed 235 of 434 reactions               
processed 236 of 434 reactions               
processed 237 of 434 reactions               
processed 238 of 434 reactions               
processed 239 of 434 reactions               
processed 240 of 434 reactions               
processed 241 of 434 reactions               
processed 242 of 434 reactions               
processed 243 of 434 reactions               
processed 244 of 434 reactions               
processed 245 of 434 reactions               
processed 246 of 434 reactions               
processed 247 of 434 reactions               
processed 248 of 434 reactions               
processed 249 of 434 reactions               
processed 250 of 434 reactions               
processed 251 of 434 reactions               
processed 252 of 434 reactions               
processed 253 of 434 reactions               
processed 254 of 434 reactions               
processed 255 of 434 reactions               
processed 256 of 434 reactions               
processed 257 of 434 reactions               
processed 258 of 434 reactions               
processed 259 of 434 reactions               
processed 260 of 434 reactions               
processed 261 of 434 reactions               
processed 262 of 434 reactions               
processed 263 of 434 reactions               
processed 264 of 434 reactions               
processed 265 of 434 reactions               
processed 266 of 434 reactions               
processed 267 of 434 reactions               
processed 268 of 434 reactions               
processed 269 of 434 reactions               
processed 270 of 434 reactions               
processed 271 of 434 reactions               
processed 272 of 434 reactions               
processed 273 of 434 reactions               
processed 274 of 434 reactions               
processed 275 of 434 reactions               
processed 276 of 434 reactions               
processed 277 of 434 reactions               
processed 278 of 434 reactions               
processed 279 of 434 reactions               
processed 280 of 434 reactions               
processed 281 of 434 reactions               
processed 282 of 434 reactions               
processed 283 of 434 reactions               
processed 284 of 434 reactions               
processed 285 of 434 reactions               
processed 286 of 434 reactions               
processed 287 of 434 reactions               
processed 288 of 434 reactions               
processed 289 of 434 reactions               
processed 290 of 434 reactions               
processed 291 of 434 reactions               
processed 292 of 434 reactions               
processed 293 of 434 reactions               
processed 294 of 434 reactions               
processed 295 of 434 reactions               
processed 296 of 434 reactions               
processed 297 of 434 reactions               
processed 298 of 434 reactions               
processed 299 of 434 reactions               
processed 300 of 434 reactions               
processed 301 of 434 reactions               
processed 302 of 434 reactions               
processed 303 of 434 reactions               
processed 304 of 434 reactions               
processed 305 of 434 reactions               
processed 306 of 434 reactions               
processed 307 of 434 reactions               
processed 308 of 434 reactions               
processed 309 of 434 reactions               
processed 310 of 434 reactions               
processed 311 of 434 reactions               
processed 312 of 434 reactions               
processed 313 of 434 reactions               
processed 314 of 434 reactions               
processed 315 of 434 reactions               
processed 316 of 434 reactions               
processed 317 of 434 reactions               
processed 318 of 434 reactions               
processed 319 of 434 reactions               
processed 320 of 434 reactions               
processed 321 of 434 reactions               
processed 322 of 434 reactions               
processed 323 of 434 reactions               
processed 324 of 434 reactions               
processed 325 of 434 reactions               
processed 326 of 434 reactions               
processed 327 of 434 reactions               
processed 328 of 434 reactions               
processed 329 of 434 reactions               
processed 330 of 434 reactions               
processed 331 of 434 reactions               
processed 332 of 434 reactions               
processed 333 of 434 reactions               
processed 334 of 434 reactions               
processed 335 of 434 reactions               
processed 336 of 434 reactions               
processed 337 of 434 reactions               
processed 338 of 434 reactions               
processed 339 of 434 reactions               
processed 340 of 434 reactions               
processed 341 of 434 reactions               
processed 342 of 434 reactions               
processed 343 of 434 reactions               
processed 344 of 434 reactions               
processed 345 of 434 reactions               
processed 346 of 434 reactions               
processed 347 of 434 reactions               
processed 348 of 434 reactions               
processed 349 of 434 reactions               
processed 350 of 434 reactions               
processed 351 of 434 reactions               
processed 352 of 434 reactions               
processed 353 of 434 reactions               
processed 354 of 434 reactions               
processed 355 of 434 reactions               
processed 356 of 434 reactions               
processed 357 of 434 reactions               
processed 358 of 434 reactions               
processed 359 of 434 reactions               
processed 360 of 434 reactions               
processed 361 of 434 reactions               
processed 362 of 434 reactions               
processed 363 of 434 reactions               
processed 364 of 434 reactions               
processed 365 of 434 reactions               
processed 366 of 434 reactions               
processed 367 of 434 reactions               
processed 368 of 434 reactions               
processed 369 of 434 reactions               
processed 370 of 434 reactions               
processed 371 of 434 reactions               
processed 372 of 434 reactions               
processed 373 of 434 reactions               
processed 374 of 434 reactions               
processed 375 of 434 reactions               
processed 376 of 434 reactions               
processed 377 of 434 reactions               
processed 378 of 434 reactions               
processed 379 of 434 reactions               
processed 380 of 434 reactions               
processed 381 of 434 reactions               
processed 382 of 434 reactions               
processed 383 of 434 reactions               
processed 384 of 434 reactions               
processed 385 of 434 reactions               
processed 386 of 434 reactions               
processed 387 of 434 reactions               
processed 388 of 434 reactions               
processed 389 of 434 reactions               
processed 390 of 434 reactions               
processed 391 of 434 reactions               
processed 392 of 434 reactions               
processed 393 of 434 reactions               
processed 394 of 434 reactions               
processed 395 of 434 reactions               
processed 396 of 434 reactions               
processed 397 of 434 reactions               
processed 398 of 434 reactions               
processed 399 of 434 reactions               
processed 400 of 434 reactions               
processed 401 of 434 reactions               
processed 402 of 434 reactions               
processed 403 of 434 reactions               
processed 404 of 434 reactions               
processed 405 of 434 reactions               
processed 406 of 434 reactions               
processed 407 of 434 reactions               
processed 408 of 434 reactions               
processed 409 of 434 reactions               
processed 410 of 434 reactions               
processed 411 of 434 reactions               
processed 412 of 434 reactions               
processed 413 of 434 reactions               
processed 414 of 434 reactions               
processed 415 of 434 reactions               
processed 416 of 434 reactions               
processed 417 of 434 reactions               
processed 418 of 434 reactions               
processed 419 of 434 reactions               
processed 420 of 434 reactions               
processed 421 of 434 reactions               
processed 422 of 434 reactions               
processed 423 of 434 reactions               
processed 424 of 434 reactions               
processed 425 of 434 reactions               
processed 426 of 434 reactions               
processed 427 of 434 reactions               
processed 428 of 434 reactions               
processed 429 of 434 reactions               
processed 430 of 434 reactions               
processed 431 of 434 reactions               
processed 432 of 434 reactions               
processed 433 of 434 reactions               
processed 434 of 434 reactions               
a test graph undirected static  
number of nodes : 360
number of edges : 14394

9.2 Analysis: user co-interaction graph


In [20]:
print(UserCoInteractionGraph.__doc__)


 
    The idea is to generate a graph where:

    Nodes: users that either posted, commented or reacted
    Edges: Two nodes (users) are connected if one has produced content
        (i.e. post or comment), and the other has reacted to that
        (i.e. cmmented or reacted to)
    

In [21]:
write_graph(ethospagejob, 'UserCoInteractionGraph')


adding posts (total: 360)
adding comments (total: 106)
adding reactions (total: 1676)
a test graph directed static  
number of nodes : 441
number of edges : 1782

Gephi time!

Rewind!

More jobs

4 + 5 set up manager

If you have restarted your Jupyter, run 4 and 5 above.


In [34]:
mgr = fb_scraper.prodcons.Manager(dict(creds))

6. Set up jobs

Insert `node_id='someinterestingid'` inside the parentheses below for the jobs

In [ ]:
myjob1 = fb_scraper.job.PageJob() # provide node_id='2931293812093' inside the parentheses
myjob2 = fb_scraper.job.GroupJob() # provide node_id='2931293812093' inside the parentheses
mgr.add_job(myjob1)
mgr.add_job(myjob2)

7. Run the jobs


In [ ]:
mgr.start()

...wait for the jobs to finish

8 + 9. Run graph analyses and profit


In [ ]:
write_graph(myjob1, 'CoReactionGraph')
write_graph(myjob2, 'UserCoInteractionGraph')

4. Collect results

Profit